/*
 * table_Statement.c
 *
 *  Created on: 2012/03/29
 *      Author: guanxiaoying
 */
#include "../../parser/coredef.h"
#include "../../parser/cc/cc.h"

typedef struct _STATEMENTINFO
{
	U2		usKind;		/* 2 */
	U2		usParentKind;	/* 3 */
	AST		astParam[5];
	AST		astLocation; /* 5 */
	AST     astParent;
	AST     astNext;
	AST     astBefore;
	AST     astListBegin;
	AST     astListEnd;
}STATEMENTINFO, *PSTATEMENTINFO;

#define TableSize  (sizeof(STATEMENTINFO ))
#define TableType  PSTATEMENTINFO
#define stTable stStatementManager.memoryBlocks
#define maxTable stStatementManager.maxRecordNum
#define  maxNumPerBlk  (stStatementManager.astMaxNum_Block)

static TABLEMANAGER stStatementManager = {
//		U4                  usIdx;
		0,
//		PSZ				    con_pszName;    constant
		__FILE__,
//		U2					con_usSize;		constant
		TableSize,
//		U2					block_num;	　　　　　　　Reset clear  際　要
		0,
//		S4					astMaxNum_Block;     １回設定のみ
		0,
//		S4					astTabNum_LastPage; 　　　　Reset clear  際　要
		0,
//		S4					astMaxNum_LastPage;     Reset clear  際　要
		0,
//		U4					ulMaxByte;	　　　　　　　　　　クリアしない
		0,
//		U4					con_minPageSize;　　　　　　　　　　constant
		0
};
static VOID resetListener( U4  procid, U2 index )
{
	if( procid == stStatementManager.u4Idx )
	{
		if( index > 0 && index < MAX_VOLUMN_OF_TABLE )
		{
			stTable[ index-1] = NULL;
		}
	}
}
static TableType core_getTable( AST index )
{
	TableType temp = (TableType)Check_Com( &stStatementManager, resetListener, index );
	if( temp != NULL ){ return &temp[index%maxNumPerBlk]; } return NULL;
}


static BOOL ClearTable( VOID )
{
	return Clear_Com( &stStatementManager );
}
static BOOL ResetTable( VOID )
{
	return Reset_Com( &stStatementManager );
}
static BOOL AllocTable( AST astReqArg )
{
	return AllocTable_Com( &stStatementManager, astReqArg, resetListener );
}
static AST getMaxLineNum( VOID )
{
	return maxTable;
}
static U2  getKind( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->usKind ;
}
static U2  setKind( AST index, U2 value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		assert_index( maxTable, index, value );
		return 0;
	}
	return pTbl->usKind = value;
}
static U2  getParentKind( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->usParentKind ;
}
static U2  setParentKind( AST index, U2 value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		assert_index( maxTable, index, value );
		return 0;
	}
	return pTbl->usParentKind = value;
}
//ACCESS_IDX_FIELD for_Init_Decl;
static AST  getFor_CnterDecl( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_FOR ){
		return 0;
	}
	return pTbl->astParam[0] ;
}
static AST  setFor_CnterDecl( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_FOR ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_FOR;
	return pTbl->astParam[0]  = value;
}
//ACCESS_IDX_FIELD for_initExp;
static AST  getFor_CnterInit( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_FOR ){
		return 0;
	}
	return pTbl->astParam[1] ;
}
static AST  setFor_CnterInit( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_FOR ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_FOR;
	return pTbl->astParam[1]  = value;
}
//ACCESS_IDX_FIELD for_CondExp;
static AST  getFor_CondExp( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_FOR ){
		return 0;
	}
	return pTbl->astParam[2] ;
}
static AST  setFor_CondExp( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_FOR ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_FOR;
	return pTbl->astParam[2]  = value;
}
//ACCESS_IDX_FIELD for_IncExp;
static AST  getFor_IncExp( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_FOR ){
		return 0;
	}
	return pTbl->astParam[3] ;
}
static AST  setFor_IncExp( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_FOR ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_FOR;
	return pTbl->astParam[3]  = value;
}
//ACCESS_IDX_FIELD for_Body;
static AST  getFor_Body( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_FOR ){
		return 0;
	}
	return pTbl->astParam[4] ;
}
static AST  setFor_Body( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_FOR ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_FOR;
	return pTbl->astParam[4]  = value;
}
//ACCESS_IDX_FIELD label_name;
static AST  getLabel_Sym( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_LABEL ){
		return 0;
	}
	return pTbl->astParam[0] ;
}
static AST  setLabel_Sym( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_LABEL ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_LABEL;
	return pTbl->astParam[0]  = value;
}
//ACCESS_IDX_FIELD label_statement;
static AST  getLabel_Stmt( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_LABEL ){
		return 0;
	}
	return pTbl->astParam[1] ;
}
static AST  setLabel_Stmt( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_LABEL ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_LABEL;
	return pTbl->astParam[1]  = value;
}
//ACCESS_IDX_FIELD label_gotoChain;
static AST  getLabel_GotoChain( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_LABEL ){
		return 0;
	}
	return pTbl->astParam[2] ;
}
static AST  setLabel_GotoChain( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_LABEL ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_LABEL;
	return pTbl->astParam[2]  = value;
}
//ACCESS_IDX_FIELD case_constExp;
static AST  getCase_Const( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_CASE ){
		return 0;
	}
	return pTbl->astParam[0] ;
}
static AST  setCase_Const( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_CASE ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_CASE;
	return pTbl->astParam[0]  = value;
}
//ACCESS_IDX_FIELD case_nextCase;
static AST  getCase_Next( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_CASE ){
		return 0;
	}
	return pTbl->astParam[1] ;
}
static AST  setCase_Next( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_CASE ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_CASE;
	return pTbl->astParam[1]  = value;
}
//ACCESS_IDX_FIELD case_statement;
static AST  getCase_Stmt( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_CASE ){
		return 0;
	}
	return pTbl->astParam[2] ;
}
static AST  setCase_Stmt( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_CASE ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_CASE;
	return pTbl->astParam[2]  = value;
}
//ACCESS_IDX_FIELD case_switch;
static AST  getCase_SwitchStmt( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_CASE ){
		return 0;
	}
	return pTbl->astParam[3] ;
}
static AST  setCase_SwitchStmt( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_CASE ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_CASE;
	return pTbl->astParam[3]  = value;
}
//ACCESS_IDX_FIELD default_statement;
static AST  getDefault_Stmt( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_DEFAULT ){
		return 0;
	}
	return pTbl->astParam[0] ;
}
static AST  setDefault_Stmt( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_DEFAULT ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_DEFAULT;
	return pTbl->astParam[0]  = value;
}
//ACCESS_IDX_FIELD default_switch;
static AST  getDefault_Switch( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_DEFAULT ){
		return 0;
	}
	return pTbl->astParam[1] ;
}
static AST  setDefault_Switch( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_DEFAULT ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_DEFAULT;
	return pTbl->astParam[1]  = value;
}
//ACCESS_IDX_FIELD default_switch;
static AST  getDeclaration( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_DEC ){
		return 0;
	}
	return pTbl->astParam[0] ;
}
static AST  setDeclaration( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_DEC ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_DEC;
	return pTbl->astParam[0]  = value;
}
//
//ACCESS_IDX_FIELD block_stmtlist;
static AST  getBlock_Chain( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_BLOCK ){
		return 0;
	}
	return pTbl->astParam[0] ;
}
static AST  setBlock_Chain( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_BLOCK ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_BLOCK;
	return pTbl->astParam[0]  = value;
}
//ACCESS_IDX_FIELD exp_exp;
static AST  getExp_Exp( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_EXP ){
		return 0;
	}
	return pTbl->astParam[0] ;
}
static AST  setExp_Exp( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_EXP ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_EXP;
	return pTbl->astParam[0]  = value;
}
//ACCESS_IDX_FIELD if_condExp;
static AST  getIf_CondExp( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_IF ){
		return 0;
	}
	return pTbl->astParam[0] ;
}
static AST  setIf_CondExp( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_IF ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_IF;
	return pTbl->astParam[0]  = value;
}
//ACCESS_IDX_FIELD if_body;
static AST  getIf_Body( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_IF ){
		return 0;
	}
	return pTbl->astParam[1] ;
}
static AST  setIf_Body( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_IF ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_IF;
	return pTbl->astParam[1]  = value;
}
//ACCESS_IDX_FIELD if_else_body;
static AST  getIf_ElseBody( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_IF ){
		return 0;
	}
	return pTbl->astParam[2] ;
}
static AST  setIf_ElseBody( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_IF ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_IF;
	return pTbl->astParam[2]  = value;
}
//
//ACCESS_IDX_FIELD switch_condExp;
static AST  getSwitch_Cond( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_SWITCH ){
		return 0;
	}
	return pTbl->astParam[0] ;
}
static AST  setSwitch_Cond( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_SWITCH ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_SWITCH;
	return pTbl->astParam[0]  = value;
}
//ACCESS_IDX_FIELD switch_body;
static AST  getSwitch_Body( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_SWITCH ){
		return 0;
	}
	return pTbl->astParam[1] ;
}
static AST  setSwitch_Body( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_SWITCH ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_SWITCH;
	return pTbl->astParam[1]  = value;
}
//ACCESS_IDX_FIELD switch_firstCase;
static AST  getSwitch_Case( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_SWITCH ){
		return 0;
	}
	return pTbl->astParam[2] ;
}
static AST  setSwitch_Case( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_SWITCH ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_SWITCH;
	return pTbl->astParam[2]  = value;
}
//ACCESS_IDX_FIELD switch_default;
static AST  getSwitch_Default( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_SWITCH ){
		return 0;
	}
	return pTbl->astParam[3] ;
}
static AST  setSwitch_Default( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_SWITCH ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_SWITCH;
	return pTbl->astParam[3]  = value;
}
//ACCESS_IDX_FIELD while_condExp;
static AST  getWhile_Cond( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_WHILE ){
		return 0;
	}
	return pTbl->astParam[0] ;
}
static AST  setWhile_Cond( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_WHILE ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_WHILE;
	return pTbl->astParam[0]  = value;
}
//ACCESS_IDX_FIELD while_body;
static AST  getWhile_Body( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_WHILE ){
		return 0;
	}
	return pTbl->astParam[1] ;
}
static AST  setWhile_Body( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_WHILE ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_WHILE;
	return pTbl->astParam[1]  = value;
}
//ACCESS_IDX_FIELD do_body;
static AST  getDo_Body( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_DO ){
		return 0;
	}
	return pTbl->astParam[0] ;
}
static AST  setDo_Body( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_DO ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_DO;
	return pTbl->astParam[0]  = value;
}
//ACCESS_IDX_FIELD do_condExp;
static AST  getDo_Cond( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_DO ){
		return 0;
	}
	return pTbl->astParam[1] ;
}
static AST  setDo_Cond( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_DO ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_DO;
	return pTbl->astParam[1]  = value;
}
//ACCESS_IDX_FIELD goto_sym;
static AST  getGoto_Sym( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_GOTO ){
		return 0;
	}
	return pTbl->astParam[0] ;
}
static AST  setGoto_Sym( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_GOTO ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_GOTO;
	return pTbl->astParam[0]  = value;
}
//ACCESS_IDX_FIELD goto_statement;
static AST  getGoto_Stmt( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_GOTO ){
		return 0;
	}
	return pTbl->astParam[1] ;
}
static AST  setGoto_Stmt( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_GOTO ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_GOTO;
	return pTbl->astParam[1]  = value;
}
//ACCESS_IDX_FIELD continue_statement;
static AST  getContinue_Stmt( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_CONTINUE ){
		return 0;
	}
	return pTbl->astParam[0] ;
}
static AST  setContinue_Stmt( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_CONTINUE ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_CONTINUE;
	return pTbl->astParam[0]  = value;
}
//ACCESS_IDX_FIELD break_statement;
static AST  getBreak_Stmt( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_BREAK ){
		return 0;
	}
	return pTbl->astParam[0] ;
}
static AST  setBreak_Stmt( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_BREAK ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_BREAK;
	return pTbl->astParam[0]  = value;
}
//ACCESS_IDX_FIELD return_exp;
static AST  getReturn_Stmt( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != STMT_RETURN ){
		return 0;
	}
	return pTbl->astParam[0] ;
}
static AST  setReturn_Stmt( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usKind != 0 && pTbl->usKind != STMT_RETURN ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usKind  );
	}
	pTbl->usKind = STMT_RETURN;
	return pTbl->astParam[0]  = value;
}
//ACCESS_IDX_FIELD codeScp;
static AST  getCodeScp( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astLocation ;
}
static AST  setCodeScp( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astLocation  = value;
}
//ACCESS_IDX_FIELD codeScp;
static AST  getNext( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astNext ;
}
static AST  setNext( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astNext  = value;
}
//ACCESS_IDX_FIELD codeScp;
static AST  getBefore( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astBefore ;
}
static AST  setBefore( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astBefore  = value;
}
//ACCESS_IDX_FIELD parent_Symbol;
static AST  getParent_Symbol( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usParentKind != KIND_SYMDEFINFO ){
		return 0;
	}
	return pTbl->astParent ;
}
static AST  setParent_Symbol( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usParentKind != 0 && pTbl->usParentKind != KIND_SYMDEFINFO ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usParentKind  );
	}
	pTbl->usParentKind = KIND_SYMDEFINFO;
	return pTbl->astParent  = value;
}
//ACCESS_IDX_FIELD parent_statement;
static AST  getParent_Stmt( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usParentKind != KIND_STATEMENTINFO ){
		return 0;
	}
	return pTbl->astParent ;
}
static AST  setParent_Stmt( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usParentKind != 0 && pTbl->usParentKind != KIND_STATEMENTINFO ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usParentKind  );
	}
	pTbl->usParentKind = KIND_STATEMENTINFO;
	return pTbl->astParent  = value;
}
//ACCESS_IDX_FIELD parent_expression;
static AST  getParent_Exp( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usParentKind != KIND_EXPRESSIONINFO ){
		return 0;
	}
	return pTbl->astParent ;
}
static AST  setParent_Exp( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	if( pTbl->usParentKind != 0 && pTbl->usParentKind != KIND_EXPRESSIONINFO ){
		Throw_MemoryError( &stStatementManager, DATA_SETTING_MISS, index, pTbl->usParentKind  );
	}
	pTbl->usParentKind = KIND_EXPRESSIONINFO;
	return pTbl->astParent  = value;
}
static AST  getBeginFlowNode( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astListBegin ;
}
static AST  setBeginFlowNode( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astListBegin  = value;
}
static AST  getEndFlowNode( AST index )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astListEnd ;
}
static AST  setEndFlowNode( AST index, AST value )
{
	TableType pTbl = core_getTable( index );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astListEnd  = value;
}
const STATEMENTACCESS stStatementAccess = {
		//		BOOL (*clear)( VOID );
				ClearTable,
		//		BOOL (*reset)( VOID );
				ResetTable,
		//		BOOL (*alloc)( AST );
				AllocTable,
		//		AST  (*getMax)( VOID );
				getMaxLineNum,
//
//		ACCESS_U2_FIELD  statmentKind;
				{
						getKind,
						setKind
				},
//		ACCESS_U2_FIELD  parentKind;
				{
						getParentKind,
						setParentKind
				},
//		ACCESS_IDX_FIELD for_Init_Decl;
				{
						getFor_CnterDecl,
						setFor_CnterDecl
				},
//		ACCESS_IDX_FIELD for_initExp;
				{
						getFor_CnterInit,
						setFor_CnterInit
				},
//		ACCESS_IDX_FIELD for_CondExp;
				{
						getFor_CondExp,
						setFor_CondExp
				},
//		ACCESS_IDX_FIELD for_IncExp;
				{
						getFor_IncExp,
						setFor_IncExp
				},
//		ACCESS_IDX_FIELD for_Body;
				{
						getFor_Body,
						setFor_Body
				},
//		ACCESS_IDX_FIELD label_name;
				{
						getLabel_Sym,
						setLabel_Sym
				},
//		ACCESS_IDX_FIELD label_statement;
				{
						getLabel_Stmt,
						setLabel_Stmt
				},
//		ACCESS_IDX_FIELD label_gotoChain;
				{
						getLabel_GotoChain,
						setLabel_GotoChain
				},
//		ACCESS_IDX_FIELD case_constExp;
				{
						getCase_Const,
						setCase_Const
				},
//		ACCESS_IDX_FIELD case_nextCase;
				{
						getCase_Next,
						setCase_Next
				},
//		ACCESS_IDX_FIELD case_statement;
				{
						getCase_Stmt,
						setCase_Stmt
				},
//		ACCESS_IDX_FIELD case_switch;
				{
						getCase_SwitchStmt,
						setCase_SwitchStmt
				},
//		ACCESS_IDX_FIELD default_statement;
				{
						getDefault_Stmt,
						setDefault_Stmt
				},
//		ACCESS_IDX_FIELD default_switch;
				{
						getDefault_Switch,
						setDefault_Switch
				},
//		ACCESS_IDX_FIELD default_statement;
				{
						getDeclaration,
						setDeclaration
				},
//		ACCESS_IDX_FIELD block_stmtlist;
				{
						getBlock_Chain,
						setBlock_Chain
				},
//
//		ACCESS_IDX_FIELD exp_exp;
				{
						getExp_Exp,
						setExp_Exp
				},
//
//		ACCESS_IDX_FIELD if_condExp;
				{
						getIf_CondExp,
						setIf_CondExp
				},
//		ACCESS_IDX_FIELD if_body;
				{
						getIf_Body,
						setIf_Body
				},
//		ACCESS_IDX_FIELD if_else_body;
				{
						getIf_ElseBody,
						setIf_ElseBody
				},
//
//		ACCESS_IDX_FIELD switch_condExp;
				{
						getSwitch_Cond,
						setSwitch_Cond
				},
//		ACCESS_IDX_FIELD switch_body;
				{
						getSwitch_Body,
						setSwitch_Body
				},
//		ACCESS_IDX_FIELD switch_firstCase;
				{
						getSwitch_Case,
						setSwitch_Case
				},
//		ACCESS_IDX_FIELD switch_default;
				{
						getSwitch_Default,
						setSwitch_Default
				},
//
//		ACCESS_IDX_FIELD while_condExp;
				{
						getWhile_Cond,
						setWhile_Cond
				},
//		ACCESS_IDX_FIELD while_body;
				{
						getWhile_Body,
						setWhile_Body
				},
//		ACCESS_IDX_FIELD do_body;
				{
						getDo_Body,
						setDo_Body
				},
//		ACCESS_IDX_FIELD do_condExp;
				{
						getDo_Cond,
						setDo_Cond
				},
//		ACCESS_IDX_FIELD goto_sym;
				{
						getGoto_Sym,
						setGoto_Sym
				},
//		ACCESS_IDX_FIELD goto_statement;
				{
						getGoto_Stmt,
						setGoto_Stmt
				},
//		ACCESS_IDX_FIELD continue_statement;
				{
						getContinue_Stmt,
						setContinue_Stmt
				},
//		ACCESS_IDX_FIELD break_statement;
				{
						getBreak_Stmt,
						setBreak_Stmt
				},
//		ACCESS_IDX_FIELD return_exp;
				{
						getReturn_Stmt,
						setReturn_Stmt
				},
//		ACCESS_IDX_FIELD codeScp;
				{
						getCodeScp,
						setCodeScp
				},
//		ACCESS_IDX_FIELD codeScp;
				{
						getNext,
						setNext
				},
//		ACCESS_IDX_FIELD codeScp;
				{
						getBefore,
						setBefore
				},
//		ACCESS_IDX_FIELD parent_Symbol;
				{
						getParent_Symbol,
						setParent_Symbol
				},
//		ACCESS_IDX_FIELD parent_statement;
				{
						getParent_Stmt,
						setParent_Stmt
				},
//		ACCESS_IDX_FIELD parent_expression;
				{
						getParent_Exp,
						setParent_Exp
				},
				{
						getBeginFlowNode,
						setBeginFlowNode
				},
				{
						getEndFlowNode,
						setEndFlowNode
				}
};
/* end of file */

